1. Technical Field
The present invention relates generally to the field of computer systems and more specifically to computer network management. Still more particularly, the present invention relates to a method, system, and product for improving the performance of a TCP connection.
2. Description of Related Art
Networked computer systems utilize communications protocols in order to communicate with each other. In order to communicate utilizing the Internet, computer systems must adhere to the Transmission Control Protocol (TCP) and the Internet Protocol (IP). The Transmission Control Protocol defines the structure and method used for assembling packets for transmission, and for disassembling received packets.
When two computer systems need to communicate with one another across a network, a software connection is established between a TCP application executing on one computer system and a TCP application executing on the other computer system. When a software connection is established, a socket is created which is associated with this particular connection. The socket is a software construct which is used to identify the particular connection. Packets are transmitted from one application to another utilizing the software connection. When a packet is received, the receiving computer system must determine which software connection was utilized. The sockets are used in order to make this determination.
Multiple applications are typically executing on each computer system. A separate software connection is established when one application needs to communicate with another. Therefore, multiple software connections may be established for one computer system. When this computer system receives a packet, it must determine to which application to forward the packet. The sockets are used to make this determination.
For each socket, a protocol control block (PCB) is established. Information about the associated connection is stored in the PCB for the socket. When a packet is received on the physical interface of a computer system, the computer system first extracts source and destination addresses and local and destination port numbers to use to locate a particular PCB. Once the particular PCB is located, the PCB is used to locate the socket which is associated with the PCB. This socket is then used to determine which user process is supposed to receive this packet. This process is described in more detail below.
FIG. 6 is a block diagram of a protocol control block (PCB) 600 and a socket 602 associated with PCB 600 in accordance with the prior art. Each PCB 600 includes a pointer 604 to a next PCB in a linked list which is included in a hash table. All of the PCBs stored in a computer system are stored linked in this manner. The PCB also includes a local TCP address 606 which is the TCP address of the computer system within which this PCB is stored. Each PCB includes a destination TCP address 608. A software connection has been established between an application executing on this local computer system and an application executing on a destination computer system. Destination TCP address 608 is the TCP address of the destination computer system. PCB 600 also includes a local port number 610 and a destination port number 612. The local port number 610 is a software variable which identifies a particular process executing on the local computer system. The destination port number 612 is a software variable which identifies a particular process executing on the destination computer system. PCB 600 includes other data 614 and a pointer 616 to the socket 602 which is associated with this PCB 600.
Socket 602 includes a send buffer 618, a receive buffer 620, and a file descriptor which identifies the process executing on the local computer system which owns this socket 602. Other data 624 is also stored in socket 602. Socket 602 includes a pointer to PCB 600 which is associated with this socket 602.
When a packet is received, the source and destination addresses, and source and destination port numbers are used to locate a particular PCB. This PCB will point to a particular socket. The PCB and socket are both associated with the software connection through which this packet was transmitted. Once the socket is located, it may be used to correctly identify the application which is to receive this packet. This process is described in more detail below.
FIG. 7 is a high level flow chart which depicts receiving a packet and forwarding the packet to its intended user process in accordance with the prior art. The process starts as depicted by block 700 and thereafter passes to block 702 which illustrates a packet being received on a computer system""s physical interface. Next, block 704 depicts the computer system generating an interrupt, processing the packet, and passing the packet to the IP layer of the computer system.
Each packet includes a header. The header includes an IP header and a TCP header. The IP header includes an IP address of the source computer and an IP address of the destination computer, as well as other IP layer and protocol information. The TCP header includes a TCP address of the source computer and a TCP address of the destination computer, as well as other TCP layer and protocol information. Block 706 illustrates getting the source and destination IP addresses from the IP header of the packet.
Block 708 depicts determining from the IP header the protocol used to transmit the packet and passing the packet to the TCP layer. Next, block 710 illustrates the TCP layer then retrieving the local and destination port numbers from the TCP layer. The process then passes to block 712 which illustrates using the local address, the local port number, the destination address, and the destination port number along with the protocol type to locate a particular PCB within the PCB hash table. The pointer stored in this particular PCB is then utilized, as depicted by block 714, to locate the socket which is associated with this particular PCB. Next, block 716 illustrates using the socket to determine which user process should receive this packet. This is the socket which was opened for this particular user process. Block 718 depicts delivering the packet to the particular user process. The process then terminates as illustrated by block 720.
The process described above must be repeated for each packet when the packet is received. Therefore, many PCBs are typically stored in a computer system. When the computer system receives a packet, it must search through these PCBs in order to locate a particular PCB. In the prior art, these PCBs are stored in a single linked list in a hash table having separate chaining such that each hash table entry represents a chain of a limited number of unique PCBs. Each element of the hash table points to a list of PCBs. The PCB hash table can become extremely large. As the hash table becomes larger, the time required to locate a particular PCB also increases. This, then, slows communication processing because a PCB must be located in the large hash table each time a packet is received.
Therefore, a need exists for a system, method, and product for improving computer network connection processing by prioritizing PCBs and storing frequently used or other high priority PCBs in a PCB cache whereby the high priority PCBs may be located quickly.
The present invention is a method, system, and product for improving the performance of a network connection by improving communication processing. Each software connection has an associated socket and protocol control block (PCB). The PCBs are prioritized. High priority PCBs are stored in a PCB cache so that the high priority PCBs may be retrieved quickly. Low priority PCBs are stored in a linked list.
Most high performance machines have deep memory hierarchies. These memory hierarchies may be exploited by adding a small PCB cache in order to generate good performance. Thus, a PCB cache is established in which high priority PCBs may be stored. Retrieving PCBs from the PCB cache is much faster than retrieving PCBs from a linked list or hash table.
The size of the fast PCB cache may be set as a network option. Ideally the PCB cache is small and contains the most frequently accessed PCBs. The PCB cache does not include any chaining, i.e. it does not include a linked list.
A priority may be assigned to each socket, and thus to the PCB associated with the socket. For example, each socket may include a special socket option, SO_PCBCACHE, wherein the socket""s priority may be stored. The PCBs associated with high priority sockets are stored in the PCB cache, while the PCBs associated with low priority sockets are stored in a linked list or hash table. In this manner, for high priority sockets, the retrieval time is reduced for the PCBs associated with these high priority sockets because the PCB cache is searched first and the PCB cache is the fastest level of memory.
For example, WEB requests may be assigned a higher priority than other connections. Therefore, the listening socket for port 80, the WEB server port number, is assigned a high priority in order to deliver high performance. Thus, the PCB associated with this connection will be stored in the PCB cache.
According to the present invention, when a packet is received, its associated connection and socket are determined. The PCB cache is first searched to try to locate the PCB associated with this socket. If the PCB is not found in the PCB cache, the hash table or linked list is then searched. If the packet is transmitted through a connection having an associated socket which is designated as having a high priority, the PCB will be stored in the PCB cache, thus, providing a faster response. For all lower priority sockets, the associated PCBs will be stored and found in the hash table.
The above as well as additional objectives, features, and advantages of the present invention will become apparent in the following detailed written description.